package pers.gxm.composite;

public class File extends Entry{
    public static void main(String[] args) {
        Directory root = new Directory("root");
            Directory bin = new Directory("bin");
            File vi = new File("vi", 1000);
            File latex = new File("latex", 200);
        root.add(bin);
                bin.add(vi);
                bin.add(latex);
            Directory tmp = new Directory("tmp");
            Directory usr = new Directory("usr");
                Directory yuki = new Directory("yuki");
                    File diary = new File("diary.html", 50);
                    File composite = new File("Composite.java", 120);
                    File meomo = new File("memo.tex", 10);
                    File game = new File("game.doc",1024);
                    File iunk = new File("iunk.mail", 500);
                yuki.add(diary);
                yuki.add(composite);



        Directory hanako = new Directory("hanako");
                hanako.add(meomo);
                Directory tomura = new Directory("tomura");
                tomura.add(game);
                tomura.add(iunk);
            root.add(tmp);
            root.add(usr);
            usr.add(yuki);
            usr.add(hanako);
            usr.add(tomura);
//            root.printList();

        String meomoPath = meomo.getAbsolutePath();
        String absolutePath2 = meomo.getAbsolutePath2();

        System.out.println("标准答案" + meomoPath);
        System.out.println("个人答案" + absolutePath2);
        System.out.println("个人答案" + hanako.getAbsolutePath2());
        System.out.println("标准答案" + hanako.getAbsolutePath());
        System.out.println(root.getAbsolutePath());



    }
    private String name;
    private int size;

    public File(String name , int size){
        this.name = name;
        this.size = size;
    }
    @Override
    public String getName() {
        return name;
    }

    @Override
    public int getSize() {
        return size;
    }

    @Override
    protected void printList(String prefix) {
        System.out.println(prefix + "/" + this);
    }
}
